import request from "@/utils/request.js";

// 爆款推荐
export function getHostList() {
	return request.get("/api/product/hostList");
}
// 精品推荐
export function getGoodList() {
	return request.get("/api/product/goodList");
}
// 限时秒杀
export function getSeckillList() {
	return request.get("/api/product/seckillList");
}

// 查询商品规格详情
export function getStoreAttrValueInfo(productId) {
	return request.get("api/product/attr-value/" + productId);
}

// 查询商品详情
export function getStoreInfo(id) {
	return request.get("/api/product/shop/" + id);
}

// 查询秒杀商品详情
export function getSeckillStoreInfo(id) {
	return request.get("api/product/seckill/" + id);
}

// 添加商品收藏
export function addCollection(data) {
	return request.post("/api/relation/add-relation", data);
}

// 判断是否商品收藏
export function getIsCollectFlag(id) {
	return request.get("api/relation/get-flag/" + id);
}

// 取消商品收藏
export function cancelCollect(id) {
	return request.get("api/relation/cancle/" + id);
}

// 判断秒杀商品是否收藏
export function getIsSeckillCollectFlag(id) {
	return request.get("api/relation/get-seckill-flag/" + id);
}

// 取消秒杀商品收藏
export function cancelSeckillCollect(id) {
	return request.get("api/relation/cancle-seckill/" + id);
}

// 添加购物车
export function addCar(data) {
	return request.post("api/cart/add", data);
}

// 精品推荐分页
export function getPageGoodList(data) {
	return request.get("/api/product/goodList", data);
}

// 限时秒杀分页
export function getPageSeckillList(data) {
	return request.get("/api/product/seckillList", data);
}

// 商城创建预下单
export function createPreOrder(data) {
	return request.post("api/store/order/pre-order", data);
}

// 商城创建预下单
export function loadPreOrder(orderNo) {
	return request.get("api/store/order/load/pre/" + orderNo);
}

// 根据分类获取商品列表
export function getListByType(data) {
	return request.get("api/product/list", data);
}